# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=libindi
pkgver=2.1.0
pkgrel=0
pkgdesc="implementation of the INDI protocol for astronomical instrumentation control"
url="https://indilib.org"
arch="all !armv7 !armhf !riscv64" # libnova
license="LGPL-2.1-only AND GPL-2.0-only AND BSD-3-Clause"
makedepends="
	boost1.84-program_options
	cfitsio-dev
	cmake
	curl-dev
	fftw-dev
	gsl-dev
	jpeg-dev
	libcamera-dev
	libev-dev
	libnova-dev
	libogg-dev
	libtheora-dev
	libusb-dev
	libxisf-dev
	qt5-qtbase-dev
	samurai
	tiff-dev
	"
checkdepends="gtest-dev"
subpackages="$pkgname-dev"
source="
	https://github.com/indilib/indi/archive/v$pkgver/indi-$pkgver.tar.gz
	0001-explicitly-include-sockets.h.patch
	"
builddir="$srcdir/indi-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DUDEVRULES_INSTALL_DIR=/usr/lib/udev/rules.d \
		-DINDI_BUILD_QT5_CLIENT=ON \
		-DINDI_BUILD_UNITTESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
e70e8a15e7f23e9690ad2d15c2d1357271c664f2d7d3ce2b489b7af748d046b11a66e82cec64aa991c383cc1a8e529795ce8d5abd488654738b4b6ef292e64e7  indi-2.1.0.tar.gz
b9a6be6b9e99546b678e7cbbdad03d8266a1d3680d50d8e2d156f9838ce5fcf7e89fb287fc57cffa23b5304c6edd12a0d50e58089d64337ea6a3a268a1dd0ec9  0001-explicitly-include-sockets.h.patch
"
